package o;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import org.jsoup.SerializationException;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Document.e;

public class gbi implements Iterable<gbh>, Cloneable {
    private static final String[] ˎ = new String[0];
    private int ˊ = 0;
    String[] ˏ = ˎ;
    String[] ॱ = ˎ;

    public /* synthetic */ Object clone() throws CloneNotSupportedException {
        return ˏ();
    }

    private void ˎ(int i) {
        gbj.ˋ(i >= this.ˊ);
        int length = this.ˏ.length;
        if (length < i) {
            length = length >= 4 ? this.ˊ * 2 : 4;
            if (i <= length) {
                i = length;
            }
            this.ˏ = ˎ(this.ˏ, i);
            this.ॱ = ˎ(this.ॱ, i);
        }
    }

    private static String[] ˎ(String[] strArr, int i) {
        Object obj = new String[i];
        System.arraycopy(strArr, 0, obj, 0, Math.min(strArr.length, i));
        return obj;
    }

    int ॱ(String str) {
        gbj.ˋ((Object) str);
        for (int i = 0; i < this.ˊ; i++) {
            if (str.equals(this.ˏ[i])) {
                return i;
            }
        }
        return -1;
    }

    private int ᐝ(String str) {
        gbj.ˋ((Object) str);
        for (int i = 0; i < this.ˊ; i++) {
            if (str.equalsIgnoreCase(this.ˏ[i])) {
                return i;
            }
        }
        return -1;
    }

    static String ˋ(String str) {
        return str == null ? "" : str;
    }

    public String ˊ(String str) {
        int ॱ = ॱ(str);
        return ॱ == -1 ? "" : ˋ(this.ॱ[ॱ]);
    }

    public String ˏ(String str) {
        int ᐝ = ᐝ(str);
        return ᐝ == -1 ? "" : ˋ(this.ॱ[ᐝ]);
    }

    private void ˎ(String str, String str2) {
        ˎ(this.ˊ + 1);
        this.ˏ[this.ˊ] = str;
        this.ॱ[this.ˊ] = str2;
        this.ˊ++;
    }

    public gbi ˏ(String str, String str2) {
        int ॱ = ॱ(str);
        if (ॱ != -1) {
            this.ॱ[ॱ] = str2;
        } else {
            ˎ(str, str2);
        }
        return this;
    }

    void ॱ(String str, String str2) {
        int ᐝ = ᐝ(str);
        if (ᐝ != -1) {
            this.ॱ[ᐝ] = str2;
            if (!this.ˏ[ᐝ].equals(str)) {
                this.ˏ[ᐝ] = str;
                return;
            }
            return;
        }
        ˎ(str, str2);
    }

    public gbi ˏ(gbh o_gbh) {
        gbj.ˋ((Object) o_gbh);
        ˏ(o_gbh.ˊ(), o_gbh.ˎ());
        o_gbh.ˏ = this;
        return this;
    }

    private void ˋ(int i) {
        gbj.ॱ(i >= this.ˊ);
        int i2 = (this.ˊ - i) - 1;
        if (i2 > 0) {
            System.arraycopy(this.ˏ, i + 1, this.ˏ, i, i2);
            System.arraycopy(this.ॱ, i + 1, this.ॱ, i, i2);
        }
        this.ˊ--;
        this.ˏ[this.ˊ] = null;
        this.ॱ[this.ˊ] = null;
    }

    public boolean ˎ(String str) {
        return ॱ(str) != -1;
    }

    public boolean ʼ(String str) {
        return ᐝ(str) != -1;
    }

    public int ॱ() {
        return this.ˊ;
    }

    public void ˎ(gbi o_gbi) {
        if (o_gbi.ॱ() != 0) {
            ˎ(this.ˊ + o_gbi.ˊ);
            Iterator it = o_gbi.iterator();
            while (it.hasNext()) {
                ˏ((gbh) it.next());
            }
        }
    }

    public Iterator<gbh> iterator() {
        return new Iterator<gbh>(this) {
            int ˋ = 0;
            final /* synthetic */ gbi ॱ;

            {
                this.ॱ = r2;
            }

            public /* synthetic */ Object next() {
                return ॱ();
            }

            public boolean hasNext() {
                return this.ˋ < this.ॱ.ˊ;
            }

            public gbh ॱ() {
                gbh o_gbh = new gbh(this.ॱ.ˏ[this.ˋ], this.ॱ.ॱ[this.ˋ], this.ॱ);
                this.ˋ++;
                return o_gbh;
            }

            public void remove() {
                gbi o_gbi = this.ॱ;
                int i = this.ˋ - 1;
                this.ˋ = i;
                o_gbi.ˋ(i);
            }
        };
    }

    public List<gbh> ˋ() {
        List arrayList = new ArrayList(this.ˊ);
        for (int i = 0; i < this.ˊ; i++) {
            Object o_gbl;
            if (this.ॱ[i] == null) {
                o_gbl = new gbl(this.ˏ[i]);
            } else {
                o_gbl = new gbh(this.ˏ[i], this.ॱ[i], this);
            }
            arrayList.add(o_gbl);
        }
        return Collections.unmodifiableList(arrayList);
    }

    public String ˊ() {
        StringBuilder ˏ = gbk.ˏ();
        try {
            ˏ((Appendable) ˏ, new Document("").ॱॱ());
            return gbk.ˎ(ˏ);
        } catch (Throwable e) {
            throw new SerializationException(e);
        }
    }

    public final void ˏ(Appendable appendable, e eVar) throws IOException {
        int i = this.ˊ;
        for (int i2 = 0; i2 < i; i2++) {
            Object obj = this.ˏ[i2];
            String str = this.ॱ[i2];
            appendable.append(' ').append(obj);
            if (!gbh.ॱ(obj, str, eVar)) {
                appendable.append("=\"");
                if (str == null) {
                    str = "";
                }
                gbt.ˊ(appendable, str, eVar, true, false, false);
                appendable.append('\"');
            }
        }
    }

    public String toString() {
        return ˊ();
    }

    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null || getClass() != obj.getClass()) {
            return false;
        }
        gbi o_gbi = (gbi) obj;
        if (this.ˊ == o_gbi.ˊ && Arrays.equals(this.ˏ, o_gbi.ˏ)) {
            return Arrays.equals(this.ॱ, o_gbi.ॱ);
        }
        return false;
    }

    public int hashCode() {
        return (((this.ˊ * 31) + Arrays.hashCode(this.ˏ)) * 31) + Arrays.hashCode(this.ॱ);
    }

    public gbi ˏ() {
        try {
            gbi o_gbi = (gbi) super.clone();
            o_gbi.ˊ = this.ˊ;
            this.ˏ = ˎ(this.ˏ, this.ˊ);
            this.ॱ = ˎ(this.ॱ, this.ˊ);
            return o_gbi;
        } catch (Throwable e) {
            throw new RuntimeException(e);
        }
    }

    public void ˎ() {
        for (int i = 0; i < this.ˊ; i++) {
            this.ˏ[i] = gbg.ˎ(this.ˏ[i]);
        }
    }
}
